import router from './router'
import { getToken } from '@/utils/auth'
import NProgress from 'nprogress'
import 'nprogress/nprogress.css'

NProgress.configure({ showSpinner: false })

const whiteList = ['/login']

// router.beforeEach(async (to, from, next) => {
//   NProgress.start()
//   const hasToken = getToken()
//   if (whiteList.includes(to.path)) {
//     next()
//     NProgress.done()
//   } else {
//     if (hasToken) {
//       next()
//       NProgress.done()
//     } else {
//       next(`/login?redirect=${to.fullPath}`)
//       NProgress.done()
//     }
//   }
// })
